package com.tiancheng.trade.settlement.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 支付渠道
 *
 * @author kellen
 * @date 2024/3/4
 */
@Getter
@AllArgsConstructor
public enum PaymentChannelEnum implements BaseEnum<String> {

    SELF("self", "自营渠道"),
    OPENBANK_CMB("cmb", "招总行渠道"),
    OPENBANK_FUDIAN("fudian", "富滇银行渠道"),
    UMS("ums", "银联渠道"),
    ;

    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<PaymentChannelEnum> found = Arrays.stream(PaymentChannelEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
